package com.travelsmart.client.apresentacao.view;

import com.google.gwt.user.client.ui.DecoratedStackPanel;
import com.google.gwt.user.client.ui.HTML;
import com.travelsmart.client.apresentacao.controller.Observer;
import com.travelsmart.client.apresentacao.i18n.I18nMessages;
import com.travelsmart.client.apresentacao.view.subview.ViewDadosRoom;
import com.travelsmart.client.apresentacao.view.subview.ViewImagensHotel;
import com.travelsmart.client.apresentacao.view.subview.ViewInfoDetalhesHotel;
import com.travelsmart.client.apresentacao.view.subview.ViewMapHotel;
import com.travelsmart.client.bean.to.HotelTO;
import com.travelsmart.client.bean.to.ReservaHotelTO;

public class ViewInfoReservaHotel extends BaseView implements Observer<ReservaHotelTO>{
	
	private final DecoratedStackPanel panelViewInfoReservaHotel = new DecoratedStackPanel();
	 
	private final ViewImagensHotel viewImagensHotel = new ViewImagensHotel();
	private final ViewMapHotel viewMapHotel = new ViewMapHotel();
	private final ViewInfoDetalhesHotel viewInfoDetalhesHotel = new ViewInfoDetalhesHotel();
	private final ViewDadosRoom viewDadosRoom = new ViewDadosRoom(new HTML(I18nMessages.INSTANCE.detalhes_quarto()));

	public ViewInfoReservaHotel() {
		super(new HTML());
		initWidget(panelViewInfoReservaHotel);
	}
	
	
	public void exec(ReservaHotelTO arg){
		panelViewInfoReservaHotel.clear();
		HotelTO hotel = arg.getHotel();
		viewInfoDetalhesHotel.exec(hotel);
		panelViewInfoReservaHotel.add(viewInfoDetalhesHotel, "<span id='informacao' >"+ I18nMessages.INSTANCE.informacao()+"</span>",true);
		viewImagensHotel.exec(hotel);
		panelViewInfoReservaHotel.add(viewImagensHotel,"<span id='imagens_hotel' >"+ I18nMessages.INSTANCE.imagens_hotel()+"</span>",true);
		viewMapHotel.exec(hotel);
		panelViewInfoReservaHotel.add(viewMapHotel, "<span id='mapa_hotel' >"+ I18nMessages.INSTANCE.mapa_hotel()+"</span>",true);
		viewDadosRoom.exec(arg.getQuartos().get(0).getQuarto());
		panelViewInfoReservaHotel.add(viewDadosRoom, "<span id='detalhes_quarto' >"+ I18nMessages.INSTANCE.detalhes_quarto()+"</span>",true);
		panelViewInfoReservaHotel.showStack(0);
	}

	@Override
	public void update(ReservaHotelTO arg) {
		exec(arg);
	}

}
